/*
** convert_to_non_prt.c for  in /home/georgi_v/rendu/PSU_2013_my_printf
** 
** Made by georgi_v
** Login   <georgi_v@epitech.net>
** 
** Started on  Sun Nov 17 10:42:16 2013 georgi_v
** Last update Fri Dec  6 19:50:56 2013 georgi_v
*/

#include <unistd.h>
#include "my.h"

int     convert_to_non_prt(va_list list)
{
  char  *result;
  int   cnt;

  result = va_arg(list, char *);
  if (result == NULL)
    return (write(1, "(null)", my_strlen("(null)")));
  cnt = 0;
  while (result[cnt])
    {
      if (result[cnt] < 10)
        {
          my_putchar('/');
          my_putchar('0');
          my_putchar('0');
          convert_to_base((int) result[cnt], "01234567");
          cnt++;
        }
      else
        if (result[cnt] > 10 && result[cnt] < 33)
          {
            my_putchar('/');
            my_putchar('0');
            convert_to_base((int) result[cnt], "01234567");
            cnt++;
          }
	else
	  if (result[cnt] == 127)
	    {
	      my_putstr("/127");
	      cnt++;
	    }
	  else
	    {
	      my_putchar(result[cnt]);
	      cnt++;
	    }
    }
  return (0);
}
